DX11 SET NULL MESH INDIRECT DRAW ARGUMENT BUFFER

Using this function you can draw as many vertices / control points for a null mesh as is given in an indirect buffer that can be written to by the GPU.
This is useful for things like particle systems where compute shaders determine how many particles to draw. You can of course read this value back to
the CPU from the GPU, but doing so induces some pretty bad performance hits if done on a per-frame basis. Using an indirect argument buffer the read-back
to the CPU can be avoided; the idea is that the buffer contains the arguments needed to issue the mesh's draw call, which the GPU can then read directly from VRAM.
There are some limitations to meshes drawn with an indirect argument buffer however; they don't support instancing.
Instances are all handled by the Ziggurat engine on the CPU and this pass is skipped when drawing indirect meshes.
As a matter of fact, you can specify a number of times to instance your drawn mesh inside the indirect argument buffer, but those instances won't be
accessible to the rest of the engine and as such won't be subject to culling or having their transform matrices calculated and made available to your shaders.
You can still discern between instances from your vertex shaders using the SV_InstanceId semantic, so if you find a reason for using instances as part of
your GPU-generated null meshes, by all means go ahead and use it. The engine will display a warning message box if you attempt to use functions such as
DX11 INSTANCE OBJECT on an object using an indirect draw argument buffer however; this is because the instancing system presented by Ziggurat will not work
with these meshes so that you can change your program to take this into account.

The indirect buffer provided to this function needs to hold at least four UINT values, whose meanings are as follows:


  • Vertex count (take note that whatever vertex count you set using DX11 SET NULL MESH VERTEX COUNT is overridden by this buffer value if you supply an indirect draw argument buffer)

  • Instance count - As described above this can be used for certain purposes. Essentially your vertex shader will be invoked InstanceCountVertexCount times. Should normally be set to 1. Note that a value of 0 here will result in no vertex shader invocations at all!

  • Offset into vertex buffer - This value is ignored since null meshes don't bind any vertex buffers. Set it to zero.

  • Offset into instance buffer - This value is also ignored since instance buffers cannot be computed for indirect argument meshes as described above. Set to zero.



If you want to stop a null mesh from being drawn using an indirect argument buffer you can call this function and specify nullptr as the buffer parameter.

  Syntax
DX11 SET NULL MESH INDIRECT DRAW ARGUMENT BUFFER mesh, indrectArgBuffer, [offset]
  Parameters
mesh
Dword
The null mesh to set the indirect draw argument buffer of. Must be a null mesh..
indrectArgBuffer
Dword
The indirect buffer containing the arguments used to draw the mesh. Set to nullptr to stop using an indirect draw argument buffer for the given mesh.
[Optional] offset
Dword
An offset (in bytes) into the indirect buffer at which to read the four UINT (DWORD) arguments described above. Defaults to zero meaning directly at the start of the buffer.

  Returns

This function does not return a value.

  See also

MESH Functions Menu
DX11 Function Categories